<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.Date,java.text.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body background=>
<% 
int number =0;
if(application.getAttribute("number") == null)
{
	number=1;
}
else
{
	number=Integer.parseInt((String)application.getAttribute("number"));
	if(session.isNew())
	{
		number=number+1;
	}
}
out.println("<h1>这是您第"+number+"次执行普通用户的修改操作！</h1>");
application.setAttribute("number",String.valueOf(number));
%>
<br>

<%
	Date nowday = new Date();
	int hour = nowday.getHours();
	SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	String time = format.format(nowday);
%>
<h1>现在时间为<%=time%></h1>
<center>
<font size =8 color=blue>
<p>普通用户人员信息列表
</font>
<form action ="NewFile7.jsp" method= post>
<input type="text" name="id" size='20' maxlength="20" placeholder="请输入您要查询者的id号">
<br>
<br>
<input type="submit" name="submit" value="提交" onclick="return gogo()" / > 
</form>
<form action ="modify.jsp" method= post>
<input type="text" name="id" size='20' maxlength="20" placeholder="请输入您要直接修改者的id号">
<br>
<br>
<input type="submit" name="submit" value="提交" onclick="return gogo()" / > 
</form>
</center>
<%
Connection con = null;
Statement st = null;
ResultSet rs =null;
try{
	Class.forName("com.mysql.jdbc.Driver");
	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","lishanshan");
	st = con.createStatement();
	rs = st.executeQuery("select * from person where juese='普通用户'");
%>
<br/>
<br/>
<table border="1" width="100%" cellpadding ="2" cellspacing="1">
<tr>
<td>
选择
</td>
<td>
姓名
</td>
<td>
年龄
</td>
<td>
性别
</td>
<td>
生日
</td>
<td>
备注
</td>
<td>
角色
</td>
<td>
操作
</td>
</tr>
<%
int a=0;
while(rs.next()){
	
	int id = rs.getInt("id");
	String name = rs.getString("name");
	int age= rs.getInt("age");
	String sex = rs.getString("sex");
	Date birthday = rs.getDate("birthday");
	String descriptions = rs.getString("descriptions");
	String juese = rs.getString("juese");
	out.println("<tr>");
	out.println("<td><input type=\"checkbox\" name=\"checkPerson\" value=\""+id+"\"></td>");
	%>
	<% 
	out.println("<td>"+name+"</td>");
	out.println("<td>"+age+"</td>");
	out.println("<td>"+sex+"</td>");
	out.println("<td>"+birthday+"</td>");
	out.println("<td>"+descriptions+"</td>");
	out.println("<td>"+juese+"</td>");
	out.println("<td><a href=\"modify.jsp?id="+id+"\">修改</a></td>");
out.println("</tr>");
}
%>
<font size=3 color=yellow>
<a href=main.jsp>返回主页面</a>
</font>
</table>
<%
}catch(SQLException e){
	e.printStackTrace();
}finally{
	try{
		rs.close();
		st.close();
		con.close();
	}catch (SQLException e){
		e.printStackTrace();
	}
}
%>
</body>
</html>